package cn.edu.dzkd.software.service;

import cn.edu.dzkd.software.mapper.User01Mapper;
import cn.edu.dzkd.software.pojo.User01;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
@Service
public class User01Service {
    @Resource
    private User01Mapper user01Mapper;
    public Map<String,Object> selectUser01s(int page){
        int index=(page-1)*10;
        Map<String,Object> map = new HashMap<>();
        List<User01> user01s=user01Mapper.selectUser01s(index);
        int counts = user01Mapper.selectUser01Counts();
        map.put("code",0);
        map.put("msg","");
        map.put("count",counts);
        map.put("data",user01s);
        return map;
    }
    public Map<String,Object> update(User01 user01){
        Map<String,Object> map=new HashMap<>();
        user01Mapper.update(user01);
        map.put("code",200);
        map.put("msg","更新成功");
        map.put("data",user01);
        return map;
    }
    public Map<String,Object> delete(Integer id){
        Map<String,Object> map=new HashMap<>();
        user01Mapper.delete(id);
        map.put("code",200);
        map.put("msg","删除成功");
        map.put("id",id);
        return map;
    }
}
